package com.zd.lib.http.response;

import com.google.gson.annotations.JsonAdapter;
import com.zd.lib.http.gson.JsonCommonDeserializer;

/**
 * Created by zoudong on 16/7/8.
 */
@JsonAdapter(JsonCommonDeserializer.class)
public class BaseEntity<T>{
    //    public transient static final int FAILURE = 0; // 失败
    public transient static final int CODE_SUCCESS = 0; // 成功


    public BaseEntity() {
    }

    public BaseEntity(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * code : 0
     * msg : 操作成功
     */

    private int code;
    private String msg;
    private T data;
    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public  boolean SUCCESS(){
        return code == CODE_SUCCESS;
    }
    @Override
    public String toString() {
        return "BaseEntity{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
